home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_300 / 332_01 / scrreg.c < prev    next >
C/C++ Source or Header  |  1990-01-05  |  2KB  |  61 lines

  1. /****************************************************************/
  2. /* Wsetscrreg() routine of the PCcurses package            */
  3. /*                                */
  4. /****************************************************************/
  5. /* This version of curses is based on ncurses, a curses version    */
  6. /* originally written by Pavel Curtis at Cornell University.    */
  7. /* I have made substantial changes to make it run on IBM PC's,    */
  8. /* and therefore consider myself free to make it public domain.    */
  9. /*                Bjorn Larsson (bl@infovox.se)    */
  10. /****************************************************************/
  11. /* 1.4:  Use of short wherever possible. Portability        */
  12. /*     improvements:                    900114    */
  13. /* 1.3:     MSC -W3, Turbo'C' -w -w-pro checkes:        881005    */
  14. /* 1.2:     Max limits off by 1. Fixed thanks to S. Creps:    881002    */
  15. /* 1.0:     Release:                    870515    */
  16. /****************************************************************/
  17.  
  18. #include <curses.h>
  19. #include <curspriv.h>
  20.  
  21. char _curses_scrreg_rcsid[] = "@(#)scrreg.c     v.1.4  - 900114";
  22.  
  23. /****************************************************************/
  24. /* Wsetscrreg() set the scrolling region of window 'win' to in-    */
  25. /* clude all lines between 'top' and 'bottom'.            */
  26. /****************************************************************/
  27.  
  28. int wsetscrreg(win, top, bottom)
  29.   WINDOW    *win;
  30.   int         top;
  31.   int         bottom;
  32.   {
  33.   if (  (0 <= top)
  34.     &&
  35.     (top <= win->_cury)
  36.     &&
  37.     (win->_cury <= bottom)
  38.     &&
  39.     (bottom < win->_maxy)
  40.      )
  41.     {
  42.     win->_regtop = top;
  43.     win->_regbottom = bottom;
  44.     return(OK);
  45.     } /* if */
  46.   else
  47.     return(ERR);
  48.   } /* wsetscrreg */
  49.  
  50. /****************************************************************/
  51. /* Setscrreg() set the scrolling region of stdscr to include    */
  52. /* all lines between 'top' and 'bottom'.            */
  53. /****************************************************************/
  54.  
  55. int setscrreg(top, bottom)
  56.   int top;
  57.   int bottom;
  58.   {
  59.   return(wsetscrreg(stdscr,top,bottom));
  60.   } /* setscrreg */
  61.